package com.fadadianqi.mall.web.controller;

import com.fadadianqi.mall.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;


@Controller
public class ShowProductsController {


    @RequestMapping(value = {"/product", "/product/", "/product/list"}, method = RequestMethod.GET)
    public String showNav(HttpServletRequest request, ModelMap modelMap) {

        return "/mall/product/list";
    }

    @RequestMapping(value = {"/product/{id}"}, method = RequestMethod.GET)
    public String showNav(HttpServletRequest request, @ModelAttribute String id, ModelMap modelMap) {

        return "/mall/product/list";
    }

    @Autowired
    private NavService navService;
}
